{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0",
   "metadata": {},
   "source": [
    "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/gee-community/geemap/blob/master/docs/notebooks/86_image_overlay.ipynb)\n",
    "[![image](https://mybinder.org/badge_logo.svg)](https://gishub.org/geemap-binder)\n",
    "\n",
    "Uncomment the following line to install [geemap](https://geemap.org) if needed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# !pip install geemap"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from geemap import geemap"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3",
   "metadata": {},
   "source": [
    "If you are using a recently implemented geemap feature that has not yet been released to PyPI or conda-forge, you can uncomment the following line to install the development version from GitHub."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4",
   "metadata": {},
   "outputs": [],
   "source": [
    "# geemap.update_package()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5",
   "metadata": {},
   "source": [
    "**Using local files**\n",
    "\n",
    "Download the sample png from https://i.imgur.com/06Q1fSz.png to your `Downloads` folder."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6",
   "metadata": {},
   "outputs": [],
   "source": [
    "filepath = \"06Q1fSz.png\"\n",
    "if not os.path.exists(filepath):\n",
    "    geemap.download_from_url(\"https://i.imgur.com/06Q1fSz.png\", filepath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7",
   "metadata": {},
   "outputs": [],
   "source": [
    "m = geemap.Map(center=(25, -115), zoom=4)\n",
    "\n",
    "image = geemap.ImageOverlay(url=filepath, bounds=((13, -130), (32, -100)))\n",
    "\n",
    "m.add_layer(image)\n",
    "m"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8",
   "metadata": {},
   "source": [
    "**Using remote files**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9",
   "metadata": {},
   "outputs": [],
   "source": [
    "m = geemap.Map(center=(25, -115), zoom=4)\n",
    "\n",
    "image = geemap.ImageOverlay(\n",
    "    url=\"https://i.imgur.com/06Q1fSz.png\", bounds=((13, -130), (32, -100))\n",
    ")\n",
    "\n",
    "m.add_layer(image)\n",
    "m"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "10",
   "metadata": {},
   "source": [
    "Update image url"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "11",
   "metadata": {},
   "outputs": [],
   "source": [
    "image.url = \"https://i.imgur.com/J9qCf4E.png\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
